package cn.tedu.basic;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

//测试  服务器
public class Test10 {
    public static void main(String[] args) throws IOException {
        ServerSocket server =new ServerSocket(10000);
        System.out.println("服务已经启动");
        Socket acc = server.accept();
        System.out.println("服务器收到客户端的连接请求");
        OutputStream out =acc.getOutputStream();
        out.write("I love you !".getBytes());
        out.close();
        InputStream inp =acc.getInputStream();
        for (int i = 0; i <12 ; i++) {
            int read = inp.read();
            char c = (char) read;
            System.out.println(c);
        }
        inp.close();

    }
}
